import 'package:cbec_app/generated/json/base/json_convert_content.dart';
import 'package:cbec_app/components/decoration/DecorationCoupon/Entity/coupon_widget_item_entity.dart';

CouponWidgetItemEntity $CouponWidgetItemEntityFromJson(Map<String, dynamic> json) {
  final CouponWidgetItemEntity couponWidgetItemEntity = CouponWidgetItemEntity();
  final int? couponId = jsonConvert.convert<int>(json['couponId']);
  if (couponId != null) {
    couponWidgetItemEntity.couponId = couponId;
  }
  final String? couponUserId = jsonConvert.convert<String>(json['couponUserId']);
  if (couponUserId != null) {
    couponWidgetItemEntity.couponUserId = couponUserId;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    couponWidgetItemEntity.name = name;
  }
  final String? type = jsonConvert.convert<String>(json['type']);
  if (type != null) {
    couponWidgetItemEntity.type = type;
  }
  final String? goodsType = jsonConvert.convert<String>(json['goodsType']);
  if (goodsType != null) {
    couponWidgetItemEntity.goodsType = goodsType;
  }
  final String? content = jsonConvert.convert<String>(json['content']);
  if (content != null) {
    couponWidgetItemEntity.content = content;
  }
  final String? drop = jsonConvert.convert<String>(json['drop']);
  if (drop != null) {
    couponWidgetItemEntity.drop = drop;
  }
  final int? dropValue = jsonConvert.convert<int>(json['dropValue']);
  if (dropValue != null) {
    couponWidgetItemEntity.dropValue = dropValue;
  }
  final String? useDate = jsonConvert.convert<String>(json['useDate']);
  if (useDate != null) {
    couponWidgetItemEntity.useDate = useDate;
  }
  final int? validityType = jsonConvert.convert<int>(json['validityType']);
  if (validityType != null) {
    couponWidgetItemEntity.validityType = validityType;
  }
  final String? validityStartTime = jsonConvert.convert<String>(json['validityStartTime']);
  if (validityStartTime != null) {
    couponWidgetItemEntity.validityStartTime = validityStartTime;
  }
  final String? validityEndTime = jsonConvert.convert<String>(json['validityEndTime']);
  if (validityEndTime != null) {
    couponWidgetItemEntity.validityEndTime = validityEndTime;
  }
  final int? hasGet = jsonConvert.convert<int>(json['hasGet']);
  if (hasGet != null) {
    couponWidgetItemEntity.hasGet = hasGet;
  }
  final int? getLimit = jsonConvert.convert<int>(json['getLimit']);
  if (getLimit != null) {
    couponWidgetItemEntity.getLimit = getLimit;
  }
  final int? ruleType = jsonConvert.convert<int>(json['ruleType']);
  if (ruleType != null) {
    couponWidgetItemEntity.ruleType = ruleType;
  }
  final int? couponType = jsonConvert.convert<int>(json['couponType']);
  if (couponType != null) {
    couponWidgetItemEntity.couponType = couponType;
  }
  return couponWidgetItemEntity;
}

Map<String, dynamic> $CouponWidgetItemEntityToJson(CouponWidgetItemEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['couponId'] = entity.couponId;
  data['couponUserId'] = entity.couponUserId;
  data['name'] = entity.name;
  data['type'] = entity.type;
  data['goodsType'] = entity.goodsType;
  data['content'] = entity.content;
  data['drop'] = entity.drop;
  data['dropValue'] = entity.dropValue;
  data['useDate'] = entity.useDate;
  data['validityType'] = entity.validityType;
  data['validityStartTime'] = entity.validityStartTime;
  data['validityEndTime'] = entity.validityEndTime;
  data['hasGet'] = entity.hasGet;
  data['getLimit'] = entity.getLimit;
  data['ruleType'] = entity.ruleType;
  data['couponType'] = entity.couponType;
  return data;
}

extension CouponWidgetItemEntityExtension on CouponWidgetItemEntity {
  CouponWidgetItemEntity copyWith({
    int? couponId,
    String? couponUserId,
    String? name,
    String? type,
    String? goodsType,
    String? content,
    String? drop,
    int? dropValue,
    String? useDate,
    int? validityType,
    String? validityStartTime,
    String? validityEndTime,
    int? hasGet,
    int? getLimit,
    int? ruleType,
    int? couponType,
  }) {
    return CouponWidgetItemEntity()
      ..couponId = couponId ?? this.couponId
      ..couponUserId = couponUserId ?? this.couponUserId
      ..name = name ?? this.name
      ..type = type ?? this.type
      ..goodsType = goodsType ?? this.goodsType
      ..content = content ?? this.content
      ..drop = drop ?? this.drop
      ..dropValue = dropValue ?? this.dropValue
      ..useDate = useDate ?? this.useDate
      ..validityType = validityType ?? this.validityType
      ..validityStartTime = validityStartTime ?? this.validityStartTime
      ..validityEndTime = validityEndTime ?? this.validityEndTime
      ..hasGet = hasGet ?? this.hasGet
      ..getLimit = getLimit ?? this.getLimit
      ..ruleType = ruleType ?? this.ruleType
      ..couponType = couponType ?? this.couponType;
  }
}
